<?php

?>

<div class="pagination-content">

    <div class="pagination-total-count">共 <?= $pagination->totalCount ?> 条数据</div>
    <div class="pagination-page-size">
        每页显示
        <select id="pagination_page_size_select" class="select-group" onchange="paginationGo(1)">
            <option value="10">10</option>
            <option value="20">20</option>
            <option value="30">30</option>
            <option value="50">50</option>
        </select>
        <script type="application/javascript">
            $('#pagination_page_size_select').val(<?= $pagination->pageSize ?>);
        </script>
        条数据
    </div>
    <div class="pagination-link-pager">
        <?= $linkPager ?>
    </div>
    <?php
    if ($pagination->pageCount > 10) {
        ?>
        <div class="pagination-total-page">共 <?= $pagination->pageCount ?> 页</div>
        <input type="number" id="pagination_page_input" class="pagination-page-input"
               value="<?= $pagination->getPage() + 1 ?>">
        <input type="button" class="btn btn-primary pagination-page-btn" value="跳转" onclick="paginationGo()">
        <?php
    }
    ?>
    <script type="application/javascript">
        function paginationGo(page) {
            var goPage = page ? page : $('#pagination_page_input').val();
            if (goPage < 1) {
                goPage = 1;
            }
            if (goPage > <?= $pagination->pageCount?>) {
                goPage = <?= $pagination->pageCount?>;
            }
            window.location.href = '<?= $goUrl ?>page=' + goPage + '&per-page=' + $('#pagination_page_size_select').val();
        }
    </script>
</div>
